package handlers;

import java.util.HashMap;
import java.util.Map;

import entity.Entity;

/**
 * The MovementHandlerLibrary maps
 * entities to their respective
 * movement handlers
 * @author DangMH
 *
 */
public class MovementHandlerLibrary {
	private static Map<Entity, MvtHandler> DICTIONARY;
	private static MovementHandlerLibrary instance;
	
	private MovementHandlerLibrary() { }
	
	public static MovementHandlerLibrary getInstance() {
		if( instance == null ) {
			instance = new MovementHandlerLibrary();
			DICTIONARY = new HashMap<Entity, MvtHandler>();
		}
		
		return instance;
	}
	
	public void register( Entity entity, MvtHandler mvtHandler ) {
		DICTIONARY.put( entity, mvtHandler );
	}
	
	public MvtHandler get( Entity entity ) {
		return DICTIONARY.get( entity );
	}
	
	public MvtHandler remove( Entity entity ) {
		return DICTIONARY.remove( entity );
	}
}
